<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>发票</title>
    <script type="text/javascript" src="__PUBLIC__/Public/js/jquery.min.1.11.3.js"></script>
	<style type="text/css">
		td{
			height: 40px;
		}
        table{
            width:900px;
            font-weight: bold;
            font-size: 14px;
            text-align: left;
            padding:0px;
            background: #aaa;
            border:solid 1px #000;
        }
        td{
            background: #fff;
        }
    </style>
</head>
<body>
	<table   border="0" align="center" >
		<caption><h1>发票(INVOICE)</h1></caption>
		<tr>
			<td colspan="4">发货人(Shipper’s information)</td>
			<td colspan="5">收货人(contact’s information)</td>

		</tr>
		<tr>
			<td>COMPANY(寄件公司)：</td>
			<td colspan="3"><!--{$data[0]['']}--></td>
			<td colspan="2">COMPANY(收件公司)：</td>
			<td colspan="3"><!--{$data[0]['rec_comp']}--></td>
		</tr>
		<tr>
			<td>ADD(寄件地址)：</td>
			<td colspan="3"><!--{$data[0]['sen_add']}--></td>
			<td colspan="2">ADD(收件地址)：</td>
			<td colspan="3"><!--{$data[0]['cname']}--><!--{$data[0]['rec_add']}--></td>
		</tr>
		<tr>
			<td>ATTN(寄件人)：</td>
			<td colspan="3"><!--{$data[0]['sender']}--></td>
			<td colspan="2">ATTN(收件人)：</td>
			<td colspan="3"><!--{$data[0]['recipients']}--></td>
		</tr>
		<tr>
			<td>TEL(寄件人电话)：</td>
			<td colspan="3" id="sen_tel"><!--{$data[0]['sen_tel']}--></td>
			<td colspan="2">TEL(收件人电话)：</td>
			<td colspan="3"><!--{$data[0]['rec_tel']}--></td>
		</tr>
		<tr>
			<td colspan="4"></td>
			<td colspan="2">收件人邮编</td>
            <td colspan="3"><!--{$data[0]['zip_code']}--></td>
		</tr>
		<tr>
			<td align="center" colspan="9"><h3>以下是必填项</h3></td>
		</tr>
		<tr>
			<td>承运人(Shipped via United parcel service)：</td>
			<td colspan="3"><!--{$data[0]['']}--></td>
			<td colspan="2">运单号(Waybill  No)：</td>
			<td colspan="3"><!--{$data[0]['way']}--></td>
		</tr>
		<tr>
			<td>NO.of units </td>
			<td>Description中文品名</td>
			<td>Description英文品名</td>
			<td>H.S.Code 海关编码</td>
			<td>purpose用途</td>
			<td>material材质</td>
			<td>Qty数量(PCS)</td>
			<td>Unit Value单价(USD)</td>
			<td>Total value总价(USD)</td>
		</tr>
        <foreach name="goods" item="val">
		<tr>
			<td><!--{++$i}--></td>
			<td><!--{$val['g_cname']}--></td>
			<td><!--{$val['g_ename']}--></td>
			<td><!--{$val['hs']}--></td>
			<td><!--{$val['']}--></td>
			<td><!--{$val['']}--></td>
			<td><!--{$val['g_items']}--></td>
			<td><!--{$val['g_total_prices']/$val['g_items']}--></td>
			<td><!--{$val['g_total_prices']}--></td>
		</tr>
        </foreach>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td align="right">TOTAL:</td>
			<td colspan="8">
                <?php
                foreach($goods as $val){
                $total+=$val['g_total_prices'];
                }
                echo $total;
                ?>
            </td>
		</tr>
		<tr align="center">
			<td colspan="9">SAMPLE OF NO COMMERCIAL VALUE(样品无商业价值)</td>
		</tr>
		<tr align="center">
			<td colspan="9">origian:china(原产国)</td>
		</tr>
		<tr>
			<td align="right">发货人签名：</td>
			<td colspan="3"></td>
			<td>日期：</td>
			<td colspan="4"></td>
		</tr>
		<tr align="right">
			<td colspan="9">本人谨此声明本发票信息真实及正确无误</td>
		</tr>
	</table>
    <div class="noprint" style="height: 50px">
    <input id="btnPrint" type="button" value="打印" onclick="javascript:window.print();" />
    </div>
    <!--将不需要打印的部分，标记为 class="noprint" -->
    <style type="text/css" media=print>
        .noprint{display : none }
    </style>
    <script type="text/javascript">
        $("#sen_tel").dblclick(function(){
            var td= $(this);
            var txt = td.text();
            var input = $("<input style='width:100px;height;10px;'type='text'value='"+txt+"'/>");
            td.html(input);
            input.click(function() { return false; });
            //获取焦点
            input.trigger("focus");
            input.blur(function() {
                var newtxt = $(this).val();
                //判断文本有没有修改
                if (newtxt != txt) {
                    td.html(newtxt);
                }else{
                    td.html(txt);
                }
            })
        })
    </script>
</body>
</html>